package com.jdragon.tljrobot.client.event.threadEvent;


import com.jdragon.tljrobot.client.component.SwingSingleton;
import com.jdragon.tljrobot.client.entry.TypingState;
import com.jdragon.tljrobot.client.event.FArea.ReplayEvent;
import com.jdragon.tljrobot.client.listener.common.TypingListener;
import lombok.extern.log4j.Log4j2;

@Log4j2
public class CountMatchThread extends Thread {
    public void run() {
        while (!TypingState.typingState) {
            try {
                sleep(1);
            } catch (InterruptedException e1) {
            }
            for (int i = 5; i >= 0; i--) {//双方准备后倒数
                try {
                    sleep(1000);
                    SwingSingleton.watchingText().setText(String.valueOf(i));
                } catch (InterruptedException e) {
                    log.debug("倒数失败");
                }
            }
            ReplayEvent.start();
            TypingState.typingState = true;
            TypingState.dailyCompetition = true;
            TypingListener.getInstance().changeFontColor();
            TypingState.typingStart();
            log.debug("赛文开始");
        }
    }
}
